import cv2
import matplotlib.pyplot as plt

picGray = cv2.imread("assets/p1.jpg", cv2.IMREAD_GRAYSCALE)
equGray = cv2.equalizeHist(picGray)
cv2.imshow("original", picGray)
cv2.imshow("equalized", equGray)

plt.figure("Original VS Equalized")
plt.subplot(1, 2, 1)
plt.hist(picGray.ravel(), 256)
plt.subplot(122)
plt.hist(equGray.ravel(), 256)
plt.show()

cv2.waitKey()